<!DOCTYPE html>
<html lang="zh-cN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OOJS</title>
    <script src="../js/js05_oojs_05.js" async></script>
    <link rel="stylesheet" href="../css/common.css"/>
</head>
<body>
    <h1>ES6中的Class语法糖</h1>
    <p class="msg"></p>
    <script>
        document.addEventListener("DOMContentLoaded",function(){
            let msg = document.querySelector(".msg");
            
            let person = new Person("张三");
            person.age=18;//访问Age Setter
            msg.innerHTML += person.sayHello();
            msg.innerHTML += "<br>";

            //person.getInstance();//TypeError
            msg.innerHTML += Person.getInstance();
            msg.innerHTML += "<br>";

            let teacher = new Teacher("王琦",40,"软件工程");
            msg.innerHTML += teacher.sayHello();
            msg.innerHTML += "<br>";
            msg.innerHTML += teacher.walk();
            msg.innerHTML += "<br>";
            
            let student = new Student();
            msg.innerHTML +=student.toString();
        });
    </script>
</body>
</html>